﻿<html>
<body style="font-family:Calibri, 新宋体">
  <p>
    <strong>Project Description (项目介绍)</strong><br />
    JPush.NET is JPush SDK for .NET. It can help you send, monitor and manage all your JPush messages by programming, following JPush official REST API.
    <br />
    (JPush.NET 是基于.NET平台的JPush服务器端的SDK。用来帮助开发者以编程的方式使用JPush官方REST API来发送、监视和管理所有的JPush推送消息。)<br />
    <br /> Click <a href="http://docs.jpush.cn/display/dev/Push-API-v3">here</a> to view JPush official document.
    <br /> (点击 <a href="http://docs.jpush.cn/display/dev/Push-API-v3">这里</a> 查看JPush官方文档.)
    <br /> <br /> This project contains following parts:(项目包含2部分)
    <ul>
      <li>Pure API client, following official REST API. You can <strong><a href="https://jpush.codeplex.com/releases/view/123507" target="_blank">download</a></strong>&nbsp;or <a href="/wikipage?title=class%3a%20JPushClient&amp;referringTitle=Documentation" target="_blank"> <strong>review documentation</strong></a>.</li>
      <li>(基于官方REST API的纯客户端。你可以从<strong><a href="https://jpush.codeplex.com/releases/view/123507" target="_blank">这里下载</a></strong> 使用或者<a href="/wikipage?title=class%3a%20JPushClient&amp;referringTitle=Documentation" target="_blank"> <strong>查看文档</strong></a>.)</li>
      <li>ASP.NET MVC based Web Portal for basic operations and simple configuration. Comming soon.</li>
      <li>(基于ASP.NET MVC的网页示例，包括基本的操作和简单的配置。即将推出)</li>
    </ul>
  </p>
  <p>&nbsp;</p>
  <p style="color: red;"><strong>IMPORTANT NOTE (重要通告):</strong></p>
  <ul>
    <li>JPush Server SDK 1.0.0 is for JPush v2, which would be retired by JPush officially.</li>
    <li>(JPush 服务器 SDK 1.0.0 是针对JPush v2版本，该版本不久之后将会被官方弃用.)</li>
    <li>To support v3, please download &amp; use <a href="https://jpush.codeplex.com/releases/" target="_blank"> latest version</a>.</li>
    <li>(如要支持JPush v3的服务器SDK，请下载和使用 <a href="https://jpush.codeplex.com/releases/" target="_blank"> 最新版本</a>.)</li>
    <li>In <a href="https://jpush.codeplex.com/releases/" target="_blank">latest version</a>, to make developers take minor change, class <a href="https://jpush.codeplex.com/wikipage?title=class%3a%20JPushClient&amp;referringTitle=Documentation" target="_blank"> JPushClient</a> has been changed to use JPushClientV3 logics inside.</li>
    <li>(在 <a href="https://jpush.codeplex.com/releases/" target="_blank">最新版</a>中，为了开发人员可以尽可能少的改动，类 <a href="https://jpush.codeplex.com/wikipage?title=class%3a%20JPushClient&amp;referringTitle=Documentation" target="_blank"> JPushClient</a> 已经被改造成内部使用JPushClientV3来处理业务)</li>
    <li>
      Major changes in v3:(JPush V3中的主要改动)
      <ul>
        <li>Always use SSL for sending/querying push message.</li>
        <li>(仅提供SSL的方式来处理发送/查询推送消息)</li>
        <li>Use Basic Authentication in HTTP Header instead of hash code for authentication.</li>
        <li>(使用HTTP 头信息中的基本验证来替代原有的哈希验证)</li>
        <li>Split model to Message and Notification to for UI/logic.</li>
        <li>(将原来模型的消息和推送部分独立，分别作用于屏幕UI上和app内部逻辑上)</li>
        <li>Enhancement and improvement for PushType. They can be multiple used in one push for complicated filter requirements.</li>
        <li>(提高和改善了PushType，他们在新版本中可以多次出现来完成更为复杂和灵活的目标筛选需求)</li>
        <li>Add Windows Phone in Platform.</li>
        <li>(增加对Windows Phone平台的支持)</li>
        <li>Provide different models for each platform.</li>
        <li>(对每个平台分别提供不同的模型来表达相关数据)</li>
      </ul>
    </li>
  </ul>
  <p><strong>Sample for class JPushClientV3: (使用 类JPushClientV3的示例)</strong></p>
  <p>Here is a sample based on .NET console application.(这是一个基于.NET控制台应用程序的示例)</p>
  <div>
    <table width="100%" cellspacing="0" cellpadding="0">
      <tbody>
        <tr>
          <td>
<pre><span style="color: #0000ff;">using</span> System;
<span style="color: #0000ff;">using</span> System.Collections.Generic;
<span style="color: #0000ff;">using</span> System.IO;
<span style="color: #0000ff;">using</span> System.Net;
<span style="color: #0000ff;">using</span> System.Text;
<span style="color: #0000ff;">using</span> System.Threading;
<span style="color: #0000ff;">using</span> ifunction.JPush.V3;
<span style="color: #0000ff;">using</span> Newtonsoft.Json;
<span style="color: #0000ff;">namespace</span> ifunction.JPush.Test
{
    <span style="color: #0000ff;">class</span> Program
    {
        <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> Main(<span style="color: #0000ff;">string</span>[] args)
        {
            <span style="color: #0000ff;">var</span> appKey = <span style="color: #cc0000;">"1234567890abcdef"</span>; <span style="color: #006633;">// Your App Key from JPush</span>
            <span style="color: #0000ff;">var</span> masterSecret = <span style="color: #cc0000;">"1234567890abcdef"</span>; <span style="color: #006633;">// Your Master Secret from JPush</span>
<br />
            Dictionary&lt;<span style="color: #0000ff;">string</span>, <span style="color: #0000ff;">string</span>&gt; customizedValues = <span style="color: #0000ff;">new</span> Dictionary&lt;<span style="color: #0000ff;">string</span>, <span style="color: #0000ff;">string</span>&gt;();
            customizedValues.Add(<span style="color: #cc0000;">"CK1"</span>, <span style="color: #cc0000;">"CV1"</span>);
            customizedValues.Add(<span style="color: #cc0000;">"CK2"</span>, <span style="color: #cc0000;">"CV2"</span>);
  <br />
            JPushClientV3 client = <span style="color: #0000ff;">new</span> JPushClientV3(appKey, masterSecret);
            Audience audience = <span style="color: #0000ff;">new</span> Audience();
            <span style="color: #006633;">// In JPush V3, tag can be multiple added with different values.</span>
            <span style="color: #006633;">// In following code, it is to send push to those who are in ((Tag1 AND Tag2) AND (Tag3 OR Tag4))</span>
            <span style="color: #006633;">// If you want to send to all, please use: audience.Add(PushTypeV3.Broadcast, null);</span>
            audience.Add(PushTypeV3.ByTagWithinAnd, <span style="color: #0000ff;">new</span> List&lt;<span style="color: #0000ff;">string</span>&gt;(<span style="color: #0000ff;">new</span> <span style="color: #0000ff;">string</span>[] { <span style="color: #cc0000;">"Tag1"</span>, <span style="color: #cc0000;">"Tag2"</span> }));
            audience.Add(PushTypeV3.ByTagWithinOr, <span style="color: #0000ff;">new</span> List&lt;<span style="color: #0000ff;">string</span>&gt;(<span style="color: #0000ff;">new</span> <span style="color: #0000ff;">string</span>[] { <span style="color: #cc0000;">"Tag3"</span>, <span style="color: #cc0000;">"Tag4"</span> }));
  <br />
            <span style="color: #006633;">// In JPush V3, Notification would not be display on screen, it would be transferred to app instead.</span>
            <span style="color: #006633;">// And different platform can provide different notification data.</span>
            Notification notification = <span style="color: #0000ff;">new</span> Notification
            {
                AndroidNotification = <span style="color: #0000ff;">new</span> AndroidNotificationParameters
                {
                    Title = <span style="color: #cc0000;">"JPush provides V3."</span>,
                    Alert = <span style="color: #cc0000;">"JPush V2 would be retired soon."</span>,
                    CustomizedValues = customizedValues
                },
                iOSNotification = <span style="color: #0000ff;">new</span> iOSNotificationParameters
                {
                    Badge = 1,
                    Alert = <span style="color: #cc0000;">"JPush V2 would be retired soon."</span>,
                    Sound = <span style="color: #cc0000;">"YourSound"</span>,
                    CustomizedValues = customizedValues
                }
            };
  <br />
            <span style="color: #0000ff;">var</span> response = client.SendPushMessage(<span style="color: #0000ff;">new</span> PushMessageRequestV3
            {
                Audience = audience,
                Platform = PushPlatform.AndroidAndiOS,
                IsTestEnvironment = <span style="color: #0000ff;">true</span>,
                AppMessage = <span style="color: #0000ff;">new</span> AppMessage
                {
                    Content = <span style="color: #cc0000;">"Hello, this is a test push of V3 from .NET. Have a nice day!"</span>,
                    CustomizedValue = customizedValues
                },
                Notification = notification
            });
  <br />
            Console.WriteLine(response.ResponseCode.ToString() + <span style="color: #cc0000;">":"</span> + response.ResponseMessage);
            Console.WriteLine(<span style="color: #cc0000;">"Push sent."</span>);
            Console.WriteLine(response.ResponseCode.ToString() + <span style="color: #cc0000;">":"</span> + response.ResponseMessage);
  <br />
            List&lt;<span style="color: #0000ff;">string</span>&gt; idToCheck = <span style="color: #0000ff;">new</span> List&lt;<span style="color: #0000ff;">string</span>&gt;();
            idToCheck.Add(response.MessageId);
  <br />
            <span style="color: #0000ff;">var</span> statusList = client.QueryPushMessageStatus(idToCheck);
  <br />
            Console.WriteLine(<span style="color: #cc0000;">"Status track is completed."</span>);
            <span style="color: #0000ff;">if</span> (statusList != <span style="color: #0000ff;">null</span>)
            {
                <span style="color: #0000ff;">foreach</span> (<span style="color: #0000ff;">var</span> one <span style="color: #0000ff;">in</span> statusList)
                {
                    Console.WriteLine(<span style="color: #0000ff;">string</span>.Format(<span style="color: #cc0000;">"Id: {0}, Android: {1}, iOS: {2}"</span>, one.MessageId, one.AndroidDeliveredCount, one.ApplePushNotificationDeliveredCount));
                }
            }
  <br />
            Console.WriteLine(<span style="color: #cc0000;">"Press any key to exit."</span>);
            Console.Read();
        }
    }
}</pre>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
  <p>RESTful API reference: <a href="http://docs.jpush.cn/display/dev/Push-API-v3"> http://docs.jpush.cn/display/dev/Push-API-v3</a></p>
  <p style="color: red;">
    <strong>IMPORTANT NOTE(重要通告):</strong><br /> 
    If you already use JPushClient V2 (Class: JPushClient), you can continue to use that. SDK Library would convert the old PushMessageRequest to PushMessageRequestV3 and send request based on JPush V3.<br />
    (如果你已经使用JPushClient V2，即SDK中的类 JPushClient，你可以继续使用它。SDK类库将在内部自动将PushMessageRequest转换到PushMessageRequestV3，并以V3形式访问JPush服务.)</p>
  <p><strong>Sample for <a href="https://jpush.codeplex.com/wikipage?title=class%3a%20JPushClient&amp;referringTitle=Documentation" target="_blank"> JPushClient</a>:</strong></p>
  <p>Here is a sample based on .NET console application.</p>
  <div>
    <table width="100%" cellspacing="0" cellpadding="0">
      <tbody>
        <tr>
          <td>
<pre xml:space="preserve"><span class="highlight-keyword" style="color: #0000FF;">class</span> Program
{
      <span class="highlight-keyword" style="color: #0000FF;">static</span> <span class="highlight-keyword" style="color: #0000FF;">void</span> Main(<span class="highlight-keyword" style="color: #0000FF;">string</span>[] args)
      {
          <span class="highlight-keyword" style="color: #0000FF;">var</span> appKey = <span class="highlight-literal" style="color: #CC0000;">"1234567890abcdef"</span>; <span class="highlight-comment" style="color: #006633;">// Your App Key from JPush</span>
          <span class="highlight-keyword" style="color: #0000FF;">var</span> masterSecret = <span class="highlight-literal" style="color: #CC0000;">"1234567890abcdef"</span>; <span class="highlight-comment" style="color: #006633;">// Your Master Secret from JPush</span>
          <br />
          Dictionary&lt;<span class="highlight-keyword" style="color: #0000FF;">string</span>, <span class="highlight-keyword" style="color: #0000FF;">string</span>&gt; customizedValues = <span class="highlight-keyword" style="color: #0000FF;">new</span> Dictionary&lt;<span class="highlight-keyword" style="color: #0000FF;">string</span>, <span class="highlight-keyword" style="color: #0000FF;">string</span>&gt;();
          customizedValues.Add(<span class="highlight-literal" style="color: #CC0000;">"CK1"</span>, <span class="highlight-literal" style="color: #CC0000;">"CV1"</span>);
          customizedValues.Add(<span class="highlight-literal" style="color: #CC0000;">"CK2"</span>, <span class="highlight-literal" style="color: #CC0000;">"CV2"</span>);
          JPushClient client = <span class="highlight-keyword" style="color: #0000FF;">new</span> JPushClient(appKey, masterSecret, <span class="highlight-keyword" style="color: #0000FF;">false</span>);
          <br />
          <span class="highlight-keyword" style="color: #0000FF;">var</span> response = client.SendPushMessage(<span class="highlight-keyword" style="color: #0000FF;">new</span> PushMessageRequest
          {
              MessageType = MessageType.Notification,
              Platform = PushPlatform.Android,
              Description = <span class="highlight-literal" style="color: #CC0000;">"DotNET"</span>,
              PushType = PushType.Broadcast,
              IsTestEnvironment = <span class="highlight-keyword" style="color: #0000FF;">true</span>,
              Message = <span class="highlight-keyword" style="color: #0000FF;">new</span> PushMessage
              {
                  Content = <span class="highlight-literal" style="color: #CC0000;">"Hello, this is a test push from .NET. Have a nice day!"</span>,
                  PushTitle = <span class="highlight-literal" style="color: #CC0000;">"A title."</span>,
                  Sound = <span class="highlight-literal" style="color: #CC0000;">"YourSound"</span>,
                  CustomizedValue = customizedValues
              }
          });
          <br />
          Console.WriteLine(response.ResponseCode.ToString() + <span class="highlight-literal" style="color: #CC0000;">":"</span> + response.ResponseMessage);
          Console.WriteLine(<span class="highlight-literal" style="color: #CC0000;">"Push sent."</span>);
          Console.WriteLine(response.ResponseCode.ToString() + <span class="highlight-literal" style="color: #CC0000;">":"</span> + response.ResponseMessage);
          <br />
          List&lt;<span class="highlight-keyword" style="color: #0000FF;">string</span>&gt; idToCheck = <span class="highlight-keyword" style="color: #0000FF;">new</span> List&lt;<span class="highlight-keyword" style="color: #0000FF;">string</span>&gt;();
          idToCheck.Add(response.MessageId);
          <br />
          <span class="highlight-keyword" style="color: #0000FF;">var</span> statusList = client.QueryPushMessageStatus(idToCheck);
          Console.WriteLine(<span class="highlight-literal" style="color: #CC0000;">"Status track is completed."</span>);
          <br />
          <span class="highlight-keyword" style="color: #0000FF;">if</span> (statusList != <span class="highlight-keyword" style="color: #0000FF;">null</span>)
          {
              <span class="highlight-keyword" style="color: #0000FF;">foreach</span> (<span class="highlight-keyword" style="color: #0000FF;">var</span> one <span class="highlight-keyword" style="color: #0000FF;">in</span> statusList)
              {
                  Console.WriteLine(<span class="highlight-keyword" style="color: #0000FF;">string</span>.Format(<span class="highlight-literal" style="color: #CC0000;">"Id: {0}, Android: {1}, iOS: {2}"</span>, one.MessageId, one.AndroidDeliveredCount, one.ApplePushNotificationDeliveredCount));
              }
          }
          <br />
          Console.WriteLine(<span class="highlight-literal" style="color: #CC0000;">"Press any key to exit."</span>);
          Console.Read();
      }
}</pre>
          </td>
        </tr>
    </table>
  </div>
  <p>
    RESTful API reference: <a href="http://docs.jpush.cn/display/dev/Index">http://docs.jpush.cn/display/dev/Index</a>
  </p>
  <p>
    <br />
    <br /> If you have any question or concern, you can contact <a href="mailto:rynn.wang@live.com"> me</a>.
    <br /> (如果你在使用过程中有任何问题或疑问，请联系 <a href="mailto:rynn.wang@live.com"> 我</a>.)
    <br /><div style="color: #EA6203; font-weight:bold;">
  If you are so kind to DONATE this project, please use Alipay app to scan the following QR for payment. Very appreciate!.
  <br /> (如果愿意资助此项目，请使用支付宝移动客户端扫描以下二维码提供资金帮助，非常感激!)
  <br />  <img src="http://download-codeplex.sec.s-msft.com/Download?ProjectName=jpush&DownloadId=866668" style="width:200px; height:200px;" />
</div>
  </p>

</body>
</html>